const path = require('path')
const { merge } = require('webpack-merge')
const common = require('./webpack.common.js')

const config = {
    mode: 'development',
    devtool: 'eval-cheap-module-source-map',
    devServer: {
        // hot: 'localhost',
        hot: 'only',
        port: 8000,
        open: true,
        static: '../dist',
        // 开启压缩
        compress: true,
        // 开发环境下，将 public 下面的静态资源静态化至 dist 目录下
        // 否则在开发服务器中访问不到这些静态资源
        // static: {
        //     directory: path.join(__dirname, '../public'),
        // },
    }
}

module.exports = merge(common, config);